﻿<UserControl
    x:Class="RK.Common.GraphicsEngine.Gui.ActivityDurationDisplayControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:RK.Common.GraphicsEngine.Gui"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="500">
    <Grid>
        <!-- Grid for header row -->
        <Grid Height="30" VerticalAlignment="Top"
                      Background="#8866AAFF">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="75" />
                <ColumnDefinition Width="75" />
                <ColumnDefinition Width="75" />
            </Grid.ColumnDefinitions>

            <TextBlock Text="Name"
                       FontSize="22" Margin="10,0,0,0" VerticalAlignment="Center"
                       Grid.Column="0" />
            <TextBlock Text="Average Time"
                       FontSize="12" TextWrapping="Wrap" TextAlignment="Center"
                       VerticalAlignment="Center"
                       Grid.Column="1" />
            <TextBlock Text="Minimum Time"
                       FontSize="12" TextWrapping="Wrap" TextAlignment="Center"
                       VerticalAlignment="Center"
                       Grid.Column="2" />
            <TextBlock Text="Maximum Time"
                       FontSize="12" TextWrapping="Wrap" TextAlignment="Center"
                       VerticalAlignment="Center"
                       Grid.Column="3" />
        </Grid>

        <!-- Grid for all items -->
        <ItemsControl ItemsSource="{Binding Path=CollectedDurationItems}"
                      Margin="00,30,0,0">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="75" />
                            <ColumnDefinition Width="75" />
                            <ColumnDefinition Width="75" />
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="{Binding Path=Name}"
                                   FontSize="22" VerticalAlignment="Center" Margin="10,0,0,0"
                                   Grid.Column="0" />
                        <TextBlock Text="{Binding Path=SumAverageMS}"
                                   FontSize="22" VerticalAlignment="Center"
                                   Grid.Column="1" />
                        <TextBlock Text="{Binding Path=SumMinMS}"
                                   FontSize="22" VerticalAlignment="Center"
                                   Grid.Column="2" />
                        <TextBlock Text="{Binding Path=SumMaxMS}"
                                   FontSize="22" VerticalAlignment="Center"
                                   Grid.Column="3" />
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>